package com.ballgame;

import javax.imageio.ImageIO;
import java.awt.*;
import java.io.IOException;
import java.net.URL;

public class GameUtil01 {

    //定义一个常量，方便调用
    public static final int FRAME_WIDTH = 600;
    public static final int FRAME_HIGHT = 600;
    public static final int PLANE_WIDTH = 30;
    public static final int PLANE_HIGHT = 30;
    //构造器私有，防止外部创建对象
    private GameUtil01(){};
    public static Image getImage(String path){
        Image img = null;
        URL url = GameUtil01.class.getClassLoader().getResource(path);
        try {
            img = ImageIO.read(url);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return img;
    }
}
